wayland: Don't emit premature configure events
authorMatthias Clasen <mclasen@redhat.com>
Fri, 7 Aug 2020 20:54:09 +0000 (16:54 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 5 Oct 2020 21:18:14 +0000 (17:18 -0400)
We should not emit configure events before we are realized - size
changes at this point are not relevant.

This gets rid of a mysterious emission of GdkSurface::size-changed
with a size of 52x52, that is happening when GtkWindow sets the
shadow_width before the window is mapped.

gdk/wayland/gdksurface-wayland.c

index e05fdc4b63f89b053428b8bda038efb70add6127..ccc4fa67efad24397f736ccabdbefbc11221989d 100644 (file)
@@ -881,24 +881,6 @@ gdk_wayland_surface_finalize (GObject *object)
   G_OBJECT_CLASS (gdk_wayland_surface_parent_class)->finalize (object);
 }
 
-static void
-gdk_wayland_surface_resize (GdkSurface *surface,
-                            int         width,
-                            int         height,
-                            int         scale)
-{
-  GdkDisplay *display;
-  GdkEvent *event;
-
-  event = gdk_configure_event_new (surface, width, height);
-
-  gdk_wayland_surface_update_size (surface, width, height, scale);
-  _gdk_surface_update_size (surface);
-
-  display = gdk_surface_get_display (surface);
-  _gdk_wayland_display_deliver_event (display, event);
-}
-
 static gboolean
 is_realized_shell_surface (GdkWaylandSurface *impl)
 {
@@ -920,6 +902,26 @@ is_realized_popup (GdkWaylandSurface *impl)
           impl->display_server.zxdg_popup_v6);
 }
 
+static void
+gdk_wayland_surface_resize (GdkSurface *surface,
+                            int         width,
+                            int         height,
+                            int         scale)
+{
+  gdk_wayland_surface_update_size (surface, width, height, scale);
+  _gdk_surface_update_size (surface);
+
+  if (is_realized_shell_surface (GDK_WAYLAND_SURFACE (surface)))
+    {
+      GdkDisplay *display;
+      GdkEvent *event;
+
+      event = gdk_configure_event_new (surface, width, height);
+      display = gdk_surface_get_display (surface);
+      _gdk_wayland_display_deliver_event (display, event);
+    }
+}
+
 static void gdk_wayland_surface_show (GdkSurface *surface,
                                       gboolean    already_mapped);
 static void gdk_wayland_surface_hide (GdkSurface *surface);